import React, { Component } from 'react';
import GChild from './GChild'; 

export default class GParent extends Component {
	state = {
		msg1: 'h111',
		msg2: 'h222',
	}

	fn2 = (ref) => {
		console.log('GParent', 'fn2', ref);
		// 调用子组件方法
		ref.testfn()
	}
	// 渲染函数
    render() {
    	return (
			<div>
				<div>GParent:点击触发子组件事件</div>
				<GChild onRef={this.fn2}></GChild>
			</div>
		);
    }
};
